library ieee;
 use ieee.std_logic_1164.all;
 use ieee.std_logic_unsigned.all;

-------------------------------------------------------------------------------
entity c_element is
-------------------------------------------------------------------------------
port( 
      -- Input i/f: --
      A     : in  std_logic;
      B     : in  std_logic;

      -- output i/f: --
      Q     : out std_logic
);           
-------------------------------------------------------------------------------
end c_element ;
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
architecture c_element_arch of c_element is
-------------------------------------------------------------------------------
	COMPONENT nd02d1 -- nand 2-in
	  PORT(
	  a1, a2 : IN std_logic;
	  zn : OUT std_logic
	  );
	END COMPONENT;

	COMPONENT nd03d1
	  PORT(
	  a1, a2, a3 : IN std_logic;
	  zn : OUT std_logic
	  );
	END COMPONENT;

signal sig11, sig12, sig13, sig21 : std_logic;

begin

Q <= sig21;

u11_nd02d1: nd02d1 
port map(
      a1   => A,
      a2   => sig21,
      zn   => sig11 
);

u12_nd02d1: nd02d1 
port map(
      a1   => A,
      a2   => B,
      zn   => sig12 
);

u13_nd02d1: nd02d1 
port map(
      a1   => B,
      a2   => sig21,
      zn   => sig13 
);

u21_nd03d1: nd03d1
port map(
      a1   => sig11,
      a2   => sig12,
      a3   => sig13,
      zn   => sig21
);
-------------------------------------------------------------------------------
end c_element_arch;
-------------------------------------------------------------------------------                 

   
-------------------------------------------------------------------------------
configuration  c_element_cfg  of c_element is
-------------------------------------------------------------------------------
   for c_element_arch
   end for;
-------------------------------------------------------------------------------
end  c_element_cfg;              
-------------------------------------------------------------------------------
                 
